package fx.game.demo.common;

import javafx.scene.control.Label;
import javafx.scene.text.Font;

import java.util.HashMap;

/**
 *
 * @author: datom
 *
 * @create: 2021/12/6 18:49
 *
 * @Deprecated 标签管理器
 *
 **/
public class LabelManage {
    
    /**
     * 游戏结束提示标签
     *
     */
    private static Label gameOverLabel;

    /**
     * 关于页面帮助本文标签
     */
    private static HashMap<String, Label> aboutHelpLabelMap;

    public static Label getGameOverLabel() {
        if(gameOverLabel == null) {
            gameOverLabel = new Label("游戏结束，点击确定重新开始");
            gameOverLabel.setFont(Font.font(20));
        }
        return gameOverLabel;
    }
    
    /**
     * @Author: datom 
     * @Date: 2021/12/6 23:08
     * 
     * @Description: 获取关于页面中帮助标签
     *
     */
    public static Label getAboutLabel(String text) {
        if(aboutHelpLabelMap == null) {
            aboutHelpLabelMap = new HashMap<>();
        }
        Label label = aboutHelpLabelMap.get(text);
        if(label == null) {
            label = new Label(text);
            label.setFont(Font.font(18));
            aboutHelpLabelMap.put(text, label);
        }
        return label;
    }
    
}
